package com.zhima.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Component;

@Component
public class DaoAuthenticationProviderCustom extends DaoAuthenticationProvider {
    /**
     * 将自定义的用户信息查询服务注入
     *
     * @param ojUserDetailServiceImpl
     */
    @Autowired
    public void setUserDetailsService(UserDetailsService ojUserDetailServiceImpl) {
        super.setUserDetailsService(ojUserDetailServiceImpl);
    }

    @Override
    protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
        // 屏蔽校验密码的过程
    }
}
